<?php
class Admin_Forms_EditUserForm extends Zend_Form {
	function __construct($option = null) {
		$this->setAction('')
				->setMethod('POST')
				->setAttrib('enctype', 'multipart/form-data')
				->setAttrib('class', 'form-horizontal');

		$money = $this->createElement('text', 'money');
		$money->addValidator(new Zend_Validate_Digits())
			->addFilter('StringTrim')
			->setRequired()
			->addValidator(
				        'NotEmpty',
				        true,
				        array('messages' => array('isEmpty' => 'Chứng minh thư không được để trống'))
				    )
            ->setLabel('Số tiền');
		$submit = $this->createElement('submit','submit',array ('label' => $option['submit'] ));
		$submit->setAttrib('class', 'btn-large');
		$cancel = $this->createElement('button', 'cancel',array('label'	=> 'Hủy bỏ','class'=>'btn btn-large','onclick'	=> 'windown:location = "' . $option['cancel_link'] . '"'));
		$this->addElement($money)
				->addElement($submit)
				->addElement($cancel);
		$this->setDecorators(array('FormElements',array('HtmlTag',array('tag'	=> 'div','width'=>'100%')),'form'));
		$this->setElementDecorators(array(
										'ViewHelper',
										'Errors',
										'Description',
										array(	
											array('data'	=> 'HtmlTag'),
											array('tag'		=> 'div','class'	=> 'controls')),
										array('label',
											array('class'	=> 'control-label','requiredSuffix'=>'(*)')),
										array(
											array('row'	=> 'HtmlTag',),
											array('class'=>'control-group ')
										),
									 	array(
								            array('ErrorsDiv' => 'HtmlTag'),
								            array('tag' => 'span', 'placement' => Zend_Form_Decorator_Abstract::APPEND)
		        						)
									)
								);
		$submit->setDecorators(array(
								'ViewHelper',
						       ));
		$cancel->setDecorators(array(
								'ViewHelper',
									)
						       );
		$this->addDisplayGroup(array('submit','cancel'),'action');
		$action = $this->getDisplayGroup('action');
		$action->setDecorators(array(
                'FormElements',
                'Fieldset',
                array('HtmlTag',array('tag'=>'div','class'	=> 'form-actions'))
        ));
	}
}